package Views;

import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.JTable;

/**
 *
 * @author Joshua King
 */
public class ViewFlights extends JPanel {

    private final int COLUMN = 9;
    private final int ROW = 15;
    private final Object[] COLUMNNAME = {"Departs", "Depart Date", "Depart Time", "Arrival",
        "Arrival Date", "Arival Time", "Seats", "Price"};
    private JTable flightsTable;
    private Object[][] tableData = new Object[ROW][COLUMN];

    public ViewFlights(ArrayList<ArrayList<String>> arr) {
        for (int i = 0; i < ROW || i < arr.size(); i++) {
            for (int j = 0; j < COLUMN - 1 || j < arr.get(i).size(); j++) {                
                tableData[i][j] = arr.get(i).get(j);
            }           
        }
        flightsTable = new JTable(tableData, COLUMNNAME);
        add(flightsTable);
        validate();
    }
}
